﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Aluno.aspx.cs" Inherits="Qvaliz.CAD.Matriculas.Aluno" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register src="../Usercontrol/wuscSeguranca.ascx" tagname="wuscSeguranca" tagprefix="uc1" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Qvaliz.CTM.Inspeções</title>
    
    <script type="text/javascript">

        //      função para inserir alunos
        function OpenWnd() {
            $find("aluno_id").set_value("");
            $find("bolsista").set_text("");
            $find("pes_nome").set_value("");
            $find("turma_matricula").set_text("");
            $find("rcb_orderBy").set_text("");

            window.radopen("Aluno_cadastro.aspx?operacao=insert", "wndInsert");
            return false;
        }

        //      função para editar alunos
        function ShowEditForm(id, rowIndex) {

            window.radopen("Aluno_cadastro.aspx?operacao=edit&ALUNO_ID=" + id, "wndEdit");
            return false;
        }

        //      função para efetuar pagamento dos alunos
        function ShowPagForm(id, rowIndex) {

            window.radopen("Aluno_pagamento.aspx?operacao=edit&ALUNO_ID=" + id, "wndPagamento");
            return false;
        }

        //      função exibir Auditoria
        function ShowAuditoria(id, rowIndex) {

            window.radopen("Auditoria.aspx?operacao=select&interface=ALUNO&interface_id=" + id, "wndAuditoria");
            return false;
        }

        //      função para tratar duplo click no grid
        function RowDblClick(sender, eventArgs) {
            window.radopen("Aluno_cadastro.aspx?operacao=edit&ALUNO_ID=" + eventArgs.getDataKeyValue("ALUNO_ID"), "wndEdit");
        }

        //      função para carregar o grid via panel ajax
        function LoadGrid() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside EDIT
        function OnClientClose() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside INSERT
        function OnClientCloseInsert(oWnd, args) {
            //  obter os parametros transferidos pelo Pop-up
            var arg = args.get_argument();
            if (arg) {
                $find("ctm_diretiva_id").set_value(arg.diretivaID);
                $find("rapGrid").ajaxRequest("load");
            }
        }

        //      função para INATIVAR o Aluno
        function WndInativar(id, rowIndex) {

            window.radopen("../Administracao/Excluir_registro.aspx?operacao=delete&interface=ALUNO&logical=S&interface_ex_name=ALU_STEXCLUIDO&interface_id_value=" + id, "wndRemover");
            return false;
        }

        //      função para INATIVAR TODOS os Alunos
        function WndInativarTodos() {

            window.radopen("../Administracao/Excluir_registro.aspx?operacao=delete&interface=ALUNO&interface_ex_name=ALU_STEXCLUIDO&update_all=S", "wndRemover");
            return false;
        }

        //      função para EXCLUIR o Aluno
        function WndDelete(id, rowIndex) {

            window.radopen("../Administracao/Excluir_registro.aspx?operacao=delete&interface=ALUNO&interface_id_value=" + id, "wndRemover");
            return false;
        }

        //      função para INATIVAR o Aluno
        function InativarAluno(id, rowIndex) {
            $find("aluno_id").set_value(id);
            $find("rapGrid").ajaxRequest("delete");
            return false;
        }

        //      função para limpar campos
        function LimparWnd() {
            $find("aluno_id").set_value("");
            $find("bolsista").set_text("");
            $find("pes_nome").set_value("");
            $find("turma_matricula").set_text("");
            $find("rcb_orderBy").set_text("");
            return false;
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
     <asp:ObjectDataSource ID="ods_Aluno" runat="server"  
        SelectMethod="_obter_Alunogeral" TypeName="Banco.BD_Aluno" 
         onselecting="ods_Aluno_Selecting"> 
        <SelectParameters> 
            <asp:Parameter Name="ALUNO_ID" Type="String" /> 
            <asp:Parameter Name="PESSOA_ID" Type="String" /> 
            <asp:Parameter Name="PES_NOME" Type="String" /> 
            <asp:Parameter Name="BOLSISTA" Type="String" /> 
            <asp:Parameter Name="TURMA_ID" Type="String" /> 
            <asp:Parameter Name="PES_PAI" Type="String" /> 
            <asp:Parameter Name="PES_MAE" Type="String" /> 
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
            <asp:Parameter Name="ALU_STEXCLUIDO" Type="String" />
        </SelectParameters> 
    </asp:ObjectDataSource> 
    <asp:ObjectDataSource ID="ods_turma" runat="server" 
        SelectMethod="_obter_Turma_matricula" TypeName="Banco.BD_Turma" 
         OldValuesParameterFormatString="original_{0}">
        <SelectParameters>
            <asp:Parameter Name="TURMA_ID" Type="String" />
            <asp:Parameter Name="TUR_DESCRICAO" Type="String" />
            <asp:Parameter Name="USUARIO_ID" Type="String" />
            <asp:Parameter Name="TURMAS_SEMALUNOS" Type="Boolean" />
        </SelectParameters>
    </asp:ObjectDataSource>
     
    <asp:HiddenField ID="hid_OPCAOPAGINA" runat="server" />

     <uc1:wuscSeguranca ID="wuscSeguranca1" runat="server" />

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="false"
         ShowContentDuringLoad="False" Skin="Sunset" 
        EnableShadow="true" ReloadOnShow="True" Animation="Resize" 
        AnimationDuration="200" Modal="True">
            <Windows>
                <telerik:RadWindow ID="wndEdit" runat="server" Title="Editar dados do Aluno" Height="370px"
                    Width="880px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                 <telerik:RadWindow ID="wndInsert" runat="server" Title="Inserir novo Aluno" Height="370px"
                    Width="900px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                <telerik:RadWindow ID="WndMatriculas" runat="server" Title="Matriculas" Height="370px"
                    Width="750px" Left="400px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndRemover" runat="server" Title="Excluir Registro" Height="320px"
                    Width="495px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndPagamento" runat="server" Title="Efetuar pagamento" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
            </Windows>
    </telerik:RadWindowManager>

    <table width="100%">
        <tr>
            <td>
                <%--<div style="float:left; margin-left:0px; width:10%">
                    <asp:Label ID="lbl_ctm_cad_inspecao_id" runat="server" Text="Código" 
                        Font-Bold="True" Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="ctm_cad_inspecao_id" runat="server" Font-Size="X-Small"
                                Width="100%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>                    
                </div>--%>
                <div style="float:left; margin-left:0px; width:10%">
                    <asp:Label ID="lbl_aluno_id" runat="server" Text="Código Interno" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="aluno_id" runat="server" Font-Size="X-Small"
                                Width="97%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>                
                </div>
                <div style="float:left; margin-left:14px; width:10%">
                    <asp:Label ID="lbl_bolsista" runat="server" Text="Bolsista" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="bolsista" runat="server" 
                                    Font-Size="X-Small" Width="100%" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" 
                                    style="margin-bottom: 0px">
                        <Items>
                            <telerik:RadComboBoxItem runat="server" />
                            <telerik:RadComboBoxItem runat="server" Text="SIM" 
                                Value="1" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="NÃO" 
                                Value="0" Font-Size="X-Small" />                            
                        </Items>
                    </telerik:RadComboBox>                    
                </div>
                <%--<div style="float:left; margin-left:14px; width:15%">
                    <asp:Label ID="Lalbl_cdi_parte" runat="server" Text="Parte" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadTextBox ID="cdi_parte" Runat="server" Font-Size="X-Small" 
                        Width="100%">
                    </telerik:RadTextBox>                
                </div>--%>
                <div style="float:left; margin-left:14px; width:20%">
                    <asp:Label ID="lbl_pes_nome" runat="server" Text="Aluno" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadTextBox ID="pes_nome" Runat="server" Font-Size="X-Small" 
                        MaxLength="200"
                        Width="97%">
                    </telerik:RadTextBox>                
                </div>
                <div style="float:left; margin-left:14px; width:34%">
                    <asp:Label ID="lbl_turma_matricula" runat="server" Text="Turma" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="turma_matricula" runat="server" 
                                    Font-Size="X-Small" Width="100%" DataTextField="TUR_DESCRICAOCOMP" 
                                    DataValueField="TURMA_ID" Filter="Contains" 
                                    EmptyMessage="Selecione uma Turma" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" onitemsrequested="turma_matricula_ItemsRequested" 
                                    style="margin-bottom: 0px">                        
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:10%">
                    <asp:Label ID="lbl_orderBy" runat="server" Text="Ordernar por" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="rcb_orderBy" runat="server" 
                                    Font-Size="X-Small" Width="100%" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" 
                                    style="margin-bottom: 0px">
                        <Items>
                            <telerik:RadComboBoxItem runat="server" />
                            <telerik:RadComboBoxItem runat="server" Text="CÓDIGO" 
                                Value="ALUNO.ALUNO_ID" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="NOME" 
                                Value="ALUNO.PES_NOME" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="TURMA" 
                                Value="ALUNO.MATRICULAS" Font-Size="X-Small" />                            
                        </Items>
                    </telerik:RadComboBox>                    
                </div>
                
                
                <div style="float:left; margin-left:10px; margin-top:10px; width:20px">
                    <asp:ImageButton ID="imgbConsultar" runat="server" 
                        ImageUrl="~/Imagens/pagina_lupa_cinza.png" 
                        ToolTip="Localizar" onclientclick="LoadGrid(); return false;" />
                               
                </div>                               
                <div style="float:left; margin-left:5px; margin-top:10px; width:20px">
                    <asp:ImageButton ID="imgbIncluir" runat="server" 
                        ImageUrl="~/Imagens/pagina_insert_cinza.png" 
                        onclientclick="OpenWnd();return false;" ToolTip="Inserir novo registro" />
                               
                </div>
                <div style="float:left; margin-left:5px; margin-top:10px; width:20px">
                    <asp:ImageButton ID="imgbInativarTodos" runat="server" 
                        ImageUrl="~/Imagens/pagina_atualizar_cinza.png" 
                        ToolTip="Localizar" onclientclick="WndInativarTodos(); return false;" />
                               
                </div> 
                
                
                
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
                 </telerik:RadScriptManager>                                  

                  <telerik:RadAjaxLoadingPanel ID="ralpGrid" runat="server" Skin="Default">
                </telerik:RadAjaxLoadingPanel>

                <telerik:RadAjaxPanel ID="rapGrid" runat="server" Height="430px" 
                    Width="100%" HorizontalAlign="NotSet" LoadingPanelID="ralpGrid" 
                    onajaxrequest="rapGrid_AjaxRequest">
                 <telerik:RadGrid ID="rdg_Aluno" runat="server" 
                    AutoGenerateColumns="False" 
                    GridLines="None" Skin="Sunset" Width="100%" AllowPaging="True" 
                    Font-Size="X-Small"  PageSize="15" Height="430px"
                    onselectedindexchanged="rdg_Aluno_SelectedIndexChanged" 
                    onitemcreated="rdg_Aluno_ItemCreated">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnRowDblClick="RowDblClick" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView CommandItemDisplay="Top" 
                         ClientDataKeyNames="ALUNO_ID" DataKeyNames="ALUNO_ID">
                        <CommandItemSettings ExportToExcelText="Exportar para Excel" 
                            ExportToPdfText="Exportar para PDF" ShowAddNewRecordButton="False" 
                            ShowExportToExcelButton="True" ShowExportToPdfButton="True" />

<%--<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>--%>

<%--<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>--%>
                        <Columns>
            <telerik:GridBoundColumn DataField="ALUNO_ID" HeaderText="Código"  
                UniqueName="ALUNO_ID"> 
                <HeaderStyle Width="60px" /> 
                <ItemStyle Font-Size="X-Small" Width="60px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="PES_NOME" HeaderText="Aluno"  
                UniqueName="PES_NOME"> 
                <HeaderStyle  /> 
                <ItemStyle Font-Size="X-Small" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="PES_PAI" HeaderText="Pai" Visible="false" 
                UniqueName="PES_PAI"> 
                <HeaderStyle Width="150px" /> 
                <ItemStyle Font-Size="X-Small" Width="150px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="PES_MAE" HeaderText="Mãe" Visible="false"
                UniqueName="PES_MAE"> 
                <HeaderStyle Width="150px" /> 
                <ItemStyle Font-Size="X-Small" Width="150px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridCheckBoxColumn DataField="BOLSISTA" HeaderText="Bolsista" 
                UniqueName="BOLSISTA">
                <HeaderStyle HorizontalAlign="Center" Width="50px" /> 
                <ItemStyle HorizontalAlign="Center" Font-Size="X-Small" Width="50px" /> 
            </telerik:GridCheckBoxColumn>
            <telerik:GridBoundColumn DataField="BOLSISTA_INTEGRAL" HeaderText="Bolsista int"  Visible="false"
                UniqueName="BOLSISTA_INTEGRAL"> 
                <HeaderStyle Width="50px" HorizontalAlign="Center"/> 
                <ItemStyle Font-Size="X-Small" Width="50px" HorizontalAlign="Center"/> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="MATRICULAS" HeaderText="Matriculas vigentes"  
                UniqueName="column5"> 
                <HeaderStyle Width="400px" /> 
                <ItemStyle Font-Size="X-Small" Width="180px" /> 
            </telerik:GridBoundColumn> 
                                              
            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Opções">
                <ItemTemplate>
                    <asp:ImageButton ID="imgGridEditar" runat="server" 
                        ImageUrl="~/Imagens/grid_edit.png" ToolTip="Editar dados do Aluno" />                                    
                    <asp:ImageButton ID="imgGridPagamento" runat="server" 
                        ImageUrl="~/Imagens/grid_cifrao.png" ToolTip="Efetuar pagamento" />
                    <%--<asp:ImageButton ID="imgbGridPNAplicavel" runat="server" 
                        ImageUrl="~/Imagens/grid_engine.png" ToolTip="Part Numbers/Modelos Aplicáveis" />--%>
                    <asp:ImageButton ID="imgbGridAuditoria" runat="server" 
                        ImageUrl="~/Imagens/grid_audit.png" ToolTip="Auditoria" />
                    <asp:ImageButton ID="imgbGridExcluir" runat="server" 
                        ImageUrl="~/Imagens/grid_delete.png" ToolTip="Excluir" />
                </ItemTemplate>
                <HeaderStyle Width="100px" />
                <ItemStyle HorizontalAlign="Left" Width="100px"/>
            </telerik:GridTemplateColumn>
        </Columns>

<EditFormSettings>
<%--<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>--%>
</EditFormSettings>
                    </MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset"></HeaderContextMenu>
                </telerik:RadGrid>
        </telerik:RadAjaxPanel>
            </td>
        </tr>
                            
    </table>

    </form>
</body>
</html>
